import platform
import os
import signal
import psutil

def kill_process(pid: int):
    if (platform.system() == 'Windows'):
        os.system(f'taskkill /f /pid {pid}')
    elif (platform.system() == 'Linux'):
        os.kill(pid, signal.SIGKILL)
    else:
        raise Exception('Unsupported platform')

def is_alive(pid: int):
    return psutil.pid_exists(pid)
    
def kill_process_self():
    kill_process(os.getpid())
